home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
System Booster
/
System Booster.iso
/
Archives
/
HardwareProjects
/
i2clib38.lha
/
Docs
/
i2c.doc
< prev
next >
Wrap
Text File
|
1994-01-28
|
5KB
|
210 lines
TABLE OF CONTENTS
i2c.library/AllocI2C
i2c.library/FreeI2C
i2c.library/GetI2COpponent
i2c.library/InitI2C
i2c.library/ReceiveI2C
i2c.library/SendI2C
i2c.library/SetDelay
i2c.library/AllocI2C i2c.library/AllocI2C
NAME
AllocI2C -- Allocate port and timer for use with I²C-bus hardware.
SYNOPSIS
ret = AllocI2C (Delay_Type, Name);
D0 D0 A1
BYTE AllocI2C (UBYTE, char *);
FUNCTION
Allocates the parallelport and needed bits to communicate according
to the I²C-bus standard specified by Philips.
If Timer-delay is used, this routine will also handle initializing
of the timer needed to keep the clock-frequency (SCL) under 100 KHz
as specified in the I²C-bus standard.
INPUTS
Delay_Type Specifies if a loop or a timer should be used
to handle the SCL-delay. To get the best
performance, it is recommended to use loop-delay
on non-accelerated Amigas, and only use the timer-
delay with accelerated Amigas.
Name Name of the program using the I²C-bus hardware and
thereby blocking the parallelport for other tasks.
RESULTS
ret Zero if no error. Detailed error-codes can be found
in i2c_library.h
NOTES
Remember to call InitI2C() after AllocI2C() before using SendI2C()
or ReceiveI2C().
SEE ALSO
BUGS
i2c.library/FreeI2C i2c.library/FreeI2C
NAME
FreeI2C -- Deallocate port and bits after use of I²C-bus.
SYNOPSIS
FreeI2C();
void FreeI2C(void);
FUNCTION
Deallocates the parallelport and used bits.
If Timer-delay was used, the timer will now be released.
RESULTS
NOTES
This function may only be called, if AllocI2C() returned zero.
SEE ALSO
BUGS
i2c.library/GetI2COpponent i2c.library/GetI2COpponent
NAME
GetI2COpponent -- Get name of task using the parallel-port.
SYNOPSIS
ret = GetI2COpponent();
STRPTR GetI2COpponent(void);
FUNCTION
If AllocI2C returns I2C_PORT_BUSY or I2C_BITS_BUSY this function
can be called to get the name of the Task using the port.
RESULTS
STRPTR to task using the parallel-port
NOTES
Only call this function if AllocI2C returns I2C_PORT_BUSY or
I2C_BITS_BUSY.
SEE ALSO
BUGS
i2c.library/InitI2C i2c.library/InitI2C
NAME
InitI2C -- Initializes the port and sets default I²C-bus conditions
SYNOPSIS
InitI2C();
void InitI2C(void);
FUNCTION
Sets the needed bits for input/output-operation. After this, the
default I²C-bus condition will de set, that is both SDA and SCL
high.
RESULTS
NOTES
This function should be called right after AllocI2C() if AllocI2C()
returns zero.
SEE ALSO
BUGS
i2c.library/ReceiveI2C i2c.library/ReceiveI2C
NAME
ReceiveI2C -- Receive bytes from the I²C-bus
SYNOPSIS
error = ReceiveI2C(addr, number, data);
D0 D0 D1 A1
UBYTE ReceiveI2C(UBYTE, int, UBYTE []);
FUNCTION
Receive data from a device connected to the I²C-bus hardware.
INPUTS
addr Address of device to receive data from.
number Number of bytes to receive from the specified device.
data Array, where to put the received data.
RESULTS
error Zero if an error occurred during reception of data
from the specified device.
NOTES
Be sure, that the size of the data-array is the same or larger than
the requested number of bytes to receive.
SEE ALSO
BUGS
i2c.library/SendI2C i2c.library/SendI2C
NAME
SendI2C -- Transmit bytes on the I²C-bus
SYNOPSIS
error = SendI2C(addr, number, data);
D0 D0 D1 A1
UBYTE SendI2C(UBYTE, int, UBYTE []);
FUNCTION
Send data to a device connected to the I²C-bus hardware.
INPUTS
addr Address of device to receive the transmitted data.
number Number of bytes to transmit from the array specified
by data.
data Array, where the data to be transmitted is placed in.
RESULTS
error Zero if an error occurred during transmitting the
data to the specified device.
NOTES
SEE ALSO
BUGS
i2c.library/SetDelay i2c.library/SetDelay
NAME
SetDelay -- Set the delay for I²C-bus clock-rate
SYNOPSIS
SetDelay(ticks);
D0
void SetDelay(ULONG);
FUNCTION
Set the delay for the I²C-bus clock. This is needed on some Amiga's,
since the I²C-bus standard specifies the maximum clock-frequency
on SCL to 100 KHz.
If timer-delay is used, the input will be handled like UNIT_MICROHZ
in the delay-routine.
RESULTS
Adjusts speed of operations on the I2C-bus
NOTES
SEE ALSO
BUGS